﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using Timetable.AWP.Host.WeekType;

namespace Timetable.AWP.ViewModels
{
    public class MainWindow: BaseViewModel
    {
        #region Current week type

        public static readonly DependencyProperty SelectedWeekTypeProperty = DependencyProperty.RegisterAttached(
                                    "SelectedWeekType", 
                                    typeof(WeekType),
                                    typeof(MainWindow), 
                                    new FrameworkPropertyMetadata(new WeekType()));
        public WeekType SelectedWeekType
        {
            get { return GetValue(SelectedWeekTypeProperty) as WeekType; }
            set
            {
                var oldValue = GetValue(SelectedWeekTypeProperty);
                SetValue(SelectedWeekTypeProperty, value);
                OnPropertyChanged(new DependencyPropertyChangedEventArgs(SelectedWeekTypeProperty, oldValue, value));
            }
        }
        #endregion

        //#region Loaded course schedule
        //public static readonly DependencyProperty CourseScheduleProperty = DependencyProperty.RegisterAttached(
        //                            "CourseSchedule",
        //                            typeof(ObservableCollection<Host.Schedule.Schedule>),
        //                            typeof(MainWindow),
        //                            new FrameworkPropertyMetadata(new ObservableCollection<Host.Schedule.Schedule>()));
        //public Host.Schedule.Schedule CourseSchedule
        //{
        //    get { return GetValue(CourseScheduleProperty) as Host.Schedule.Schedule; }
        //    set
        //    {
        //        var oldValue = GetValue(CourseScheduleProperty);
        //        SetValue(CourseScheduleProperty, value);
        //        OnPropertyChanged(new DependencyPropertyChangedEventArgs(CourseScheduleProperty, oldValue, value));
        //    }
        //} 

        //#endregion

        //#region Loaded specialities schedule

        //public static readonly DependencyProperty SpecialitiesScheduleProperty = DependencyProperty.RegisterAttached(
        //                            "SpecialitiesSchedule",
        //                            typeof(ObservableCollection<Host.Schedule.Schedule>),
        //                            typeof(MainWindow),
        //                            new FrameworkPropertyMetadata(new ObservableCollection<Host.Schedule.Schedule>()));
        //public ObservableCollection<Host.Schedule.Schedule> SpecialitiesSchedule
        //{
        //    get { return GetValue(SpecialitiesScheduleProperty) as ObservableCollection<Host.Schedule.Schedule>; }
        //    set
        //    {
        //        var oldValue = GetValue(SpecialitiesScheduleProperty);
        //        SetValue(SpecialitiesScheduleProperty, value);
        //        OnPropertyChanged(new DependencyPropertyChangedEventArgs(SpecialitiesScheduleProperty, oldValue, value));
        //    }
        //}
        //#endregion

        #region Loaded groups schedule

        //public static readonly DependencyProperty GroupSchedulesProperty = DependencyProperty.RegisterAttached(
        //                            "GroupsSchedules",
        //                            typeof(ObservableCollection<Host.Schedule.Schedule>),
        //                            typeof(MainWindow),
        //                            new  PropertyMetadata(new ObservableCollection<Host.Schedule.Schedule>()));

        //private static void OnGroupSchedulesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        //{
        //}

        //public ObservableCollection<Host.Schedule.Schedule> GroupSchedules
        //{
        //    get { return GetValue(GroupSchedulesProperty) as ObservableCollection<Host.Schedule.Schedule>; }
        //    set
        //    {
        //        var oldValue = GetValue(GroupSchedulesProperty);
        //        SetValue(GroupSchedulesProperty, value);
        //        OnPropertyChanged(new DependencyPropertyChangedEventArgs(GroupSchedulesProperty, oldValue, value));
        //    }
        //}

        ////public static DependencyProperty GroupsScheduleProperty;
        ////public ObservableCollection<Host.Schedule.Schedule> GroupsSchedule
        ////{
        ////    get { return GetValue(GroupsScheduleProperty) as ObservableCollection<Host.Schedule.Schedule>; }
        ////    set
        ////    {
        ////        var oldValue = GetValue(GroupsScheduleProperty);
        ////        SetValue(GroupsScheduleProperty, value);
        ////        OnPropertyChanged(new DependencyPropertyChangedEventArgs(GroupsScheduleProperty, oldValue, value));
        ////    }
        ////}

        ////private static void OnCourseSchedulesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        ////{
        ////}
        #endregion

        public MainWindow()
        {
            //GroupsScheduleProperty = Schedule.GroupSchedulesProperty.AddOwner(
            //    typeof(ScheduleEditor), 
            //    new FrameworkPropertyMetadata(
            //        new ObservableCollection<Host.Schedule.Schedule>(), 
            //        OnCourseSchedulesChanged));
        }
    }
}
